 <html>                                                                                                                                                                      
   <head>                                                                                                                                                                    
     <title>Example</title>                                                                                                                                                  
   </head>                                                                                                                                                                   
   <body>                                                                                                                                                                    
     <div id="welcomeMessage"></div>                                                                                                                                         

     <!-- Load the Facebook JavaScript SDK -->                                                                                                                               
     <div id="fb-root"></div>                                                                                                                                                
     <script>                                                                                                                                                                
       window.fbAsyncInit = function() {                                                                                                                                     
         FB.init({                                                                                                                                                           
           appId      : '120005274854592', // App ID                                                                                                                         
           status     : true, // check login status                                                                                                                          
           cookie     : true                                                                                                                                                 
         });                                                                                                                                                                 

         // Check if the current user is logged in                                                                                                                           
         // and has authorized the app                                                                                                                                       
         FB.getLoginStatus(function(response) {                                                                                                                              
           // Check the result of the user                                                                                                                                   
           if(response && response.status == 'connected') {                                                                                                                  

             // and has authorized the app.                                                                                                                                  
             // Now personalize the user experience                                                                                                                          

             FB.api('/me', function(response) {                                                                                                                              
               var message = document.getElementById('welcomeMessage');                                                                                                      
               message.innerHTML = 'Hello, ' + response.first_name;                                                                                                          
             });                                                                                                                                                             
           } else {                                                                                                                                                          
             // The user has not authenticated your app,                                                                                                                     
             // proceed with your normal (anonymous) flow.                                                                                                                   
           }                                                                                                                                                                 
         });                                                                                                                                                                 
       };                                                                                                                                                                    

       // Load the SDK Asynchronously                                                                                                                                        
       (function(d){                                                                                                                                                         
         var js;                                                                                                                                                             
         var id = 'facebook-jssdk';                                                                                                                                          
         var ref = d.getElementsByTagName('script')[0];                                                                                                                      
         if (d.getElementById(id)) {return;}                                                                                                                                 
         js = d.createElement('script');                                                                                                                                     
         js.id = id;                                                                                                                                                         
         js.async = true;                                                                                                                                                    
         js.src = "//connect.facebook.net/en_US/all.js";                                                                                                                     
         ref.parentNode.insertBefore(js, ref);                                                                                                                               
       }(document));                                                                                                                                                         
     </script>                                                                                                                                                               
   </body>                                                                                                                                                                   
 </html>